import axios from 'axios';

// 删除指定id的菜单
let remove_menu = (menu_id, params) => axios.delete(`/menu/${menu_id}`, { params });

// 更新指定id的菜单
let update = (menu_id, data) => axios.put(`/menu/${menu_id}`, data);

// 添加菜单
let add = (data) => axios.post('/menu', data);

// 获取子级菜单
let sub = (params) => axios.get('/menu/sub', { params });

// 获取所有菜单
let all = (params) => axios.get('/menu/all', { params });

// 菜单页面--删除指定id的操作按钮
let remove_operation = (permission_id, params) => axios.delete(`/menu/operation/${permission_id}`, { params });

// 菜单页面--添加新的操作按钮
let add_operation = (data) => axios.post('/menu/operation', data);

// 菜单页面--编辑操作按钮
let edit_operation = (permission_id, data) => axios.put(`/menu/operation/${permission_id}`, data);

// 设置指定id的菜单图标
let icon = (menu_id, data) => axios.put(`/menu/icon/${menu_id}`, data);

export default {
    add,
    remove_menu,
    update,
    sub,
    all,
    remove_operation,
    add_operation,
    edit_operation,
    icon,
}
